/*
 *------------------------------------------------------------------------------
 * @File      :    ei_mai_errno.h
 * @Date      :    2021-4-8
 * @Author    :    lomboswer <lomboswer@lombotech.com>
 * @Brief     :    Media Interface for MADP(Media Development Platform).
 *
 * Copyright (C) 2020-2021, LomboTech Co.Ltd. All rights reserved.
 *------------------------------------------------------------------------------
 */

#ifndef __EI_MAI_ERRNO_H__
#define __EI_MAI_ERRNO_H__

#ifdef __cplusplus
#if __cplusplus
extern "C"{
#endif
#endif

/* FIXME */
#define EI_MADP_ERR_APPID  (0x80000000L + 0x23000000L)

typedef enum eiMADP_ERR_LEVEL_E {
	MADP_EN_ERR_LEVEL_DEBUG = 0,	/* debug-level                                  */
	MADP_EN_ERR_LEVEL_INFO,			/* informational                                */
	MADP_EN_ERR_LEVEL_NOTICE,		/* normal but significant condition             */
	MADP_EN_ERR_LEVEL_WARNING,		/* warning conditions                           */
	MADP_EN_ERR_LEVEL_ERROR,		/* error conditions                             */
	MADP_EN_ERR_LEVEL_CRIT,			/* critical conditions                          */
	MADP_EN_ERR_LEVEL_ALERT,		/* action must be taken immediately             */
	MADP_EN_ERR_LEVEL_FATAL,		/* just for compatibility with previous version */
	MADP_EN_ERR_LEVEL_BUTT
} MADP_ERR_LEVEL_E;

#define EI_MADP_DEF_ERR( module, level, errid) \
    ((EI_S32)( (EI_MADP_ERR_APPID) | ((module) << 16 ) | ((level)<<13) | (errid) ))

typedef enum eiMADP_EN_ERR_CODE_E
{
    MADP_EN_ERR_INVALID_DEVID = 1, /* invlalid device ID                           */
    MADP_EN_ERR_INVALID_CHNID = 2, /* invlalid channel ID                          */
    MADP_EN_ERR_ILLEGAL_PARAM = 3, /* at lease one parameter is illagal
                               * eg, an illegal enumeration value             */
    MADP_EN_ERR_EXIST         = 4, /* resource exists                              */
    MADP_EN_ERR_UNEXIST       = 5, /* resource unexists                            */

    MADP_EN_ERR_NULL_PTR      = 6, /* using a NULL point                           */

    MADP_EN_ERR_NOT_CONFIG    = 7, /* try to enable or initialize system, device
                              ** or channel, before configing attribute       */

    MADP_EN_ERR_NOT_SUPPORT   = 8, /* operation or type is not supported by NOW    */
    MADP_EN_ERR_NOT_PERM      = 9, /* operation is not permitted
                              ** eg, try to change static attribute           */

    MADP_EN_ERR_NOMEM         = 12,/* failure caused by malloc memory              */
    MADP_EN_ERR_NOBUF         = 13,/* failure caused by malloc buffer              */

    MADP_EN_ERR_BUF_EMPTY     = 14,/* no data in buffer                            */
    MADP_EN_ERR_BUF_FULL      = 15,/* no buffer for new data                       */

    MADP_EN_ERR_SYS_NOTREADY  = 16,/* System is not ready,maybe not initialed or
                              ** loaded. Returning the error code when opening
                              ** a device file failed.                        */

    MADP_EN_ERR_BADADDR       = 17,/* bad address,
                              ** eg. used for copy_from_user & copy_to_user   */

    MADP_EN_ERR_BUSY          = 18,/* resource is busy,
                              ** eg. destroy a venc chn without unregister it */

    MADP_EN_ERR_BUTT          = 63,/* maxium code, private error code of all modules
                              ** must be greater than it                      */
}MADP_EN_ERR_CODE_E;

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

#endif
